<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>行程记录</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">

    <link rel="stylesheet" href="/sunfc/css/weui.min.css">
    <link rel="stylesheet" href="/sunfc/css/jquery-weui.css">
    <link rel="stylesheet" href="/sunfc/css/style.css">

    <style type="text/css">
        .pos-tel .pos-xcjl{position: absolute;top:8px;right:0;color: #aeaeae}
        .xingchengz .weui-cells{position: relative;}
        .xingchengz .weui-cells .pos-yuan{position: absolute;bottom:0;right:0;}
        .xingchengz .weui-cells .pos-yuan span{font-size: 30px;}
        .noMore{text-align: center;line-height: 34px;color: #8e9295;}
        .index-kuashi .xcjl-title{position: fixed;width:70%;left:0;right:0;margin: 0 auto;background: none;}
        .index-kuashi .xcjl-title .weui-navbar__item{padding: 9px 0px;margin-right:9vw;margin-left:9vw;}
    </style>
</head>
<body ontouchstart class="back1">
<div class="shineiSF">
    <div class="index-top">
        <div class="index-back" onClick="javascript:history.back(-1);">
            <img src="/sunfc/images/back.png" width="15">
        </div>
    </div>
</div>
<div style="">
    <div class="weui-tab index-kuashi">
        <div class="weui-navbar xcjl-title" id="navbarShi">
            <a class="weui-navbar__item weui-bar__item--on" href="#tab1" vid="0">
                我是乘客
            </a>
            <a class="weui-navbar__item" href="#tab2" vid="1">
                我是车主
            </a>
        </div>

        <div class="weui-tab__bd">
            <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active infinite" style="overflow-x:hidden; width:100%; height:620px;">
                <div  id="list"  style="overflow-y:auto; overflow-x:hidden; width:100%; height:100%;padding-right: 15px">
                    <div class="content-padded">

                    </div>
                    <div class="weui-loadmore">
                        <i class="weui-loading"></i>
                        <span class="weui-loadmore__tips">正在加载</span>
                    </div>
                </div>
            </div>
            <div id="tab2" class="weui-tab__bd-item infinite" style="overflow-x:hidden; width:100%; height:620px;">
                <div id="list2" style="overflow-y:auto; overflow-x:hidden; width:100%; height:100%;padding-right: 15px">
                    <div class="content-padded">

                    </div>
                    <div class="weui-loadmore">
                        <i class="weui-loading"></i>
                        <span class="weui-loadmore__tips">正在加载</span>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<script src="/sunfc/js/jquery-2.1.4.js"></script>
<script src="/sunfc/js/jquery-weui.min.js"></script>
<script>
    var page =1;
    var page1 =1;
    var flag =0;
    var flag1 =0;
    //初始化数据
    $( function() {
        $("#list").find(".weui-loadmore").show();
        $("#list2").find(".weui-loadmore").show();
        console.log('用户作为乘客数据初始化');
        $.get('/index/sunfc.passenger/travel_records',
            function (res) {
                console.log('拿到初始化数据===》'+res.code);
                console.log(res.data);
                var data =res.data;
                console.log('乘客数据初始化长度==>'+data.length);
                for(var i=data.length-1;i>=0;i--){
                    console.log(i);
                    $("#list").find('.content-padded').append("<div class=\"index-box index-xingchengz\">\n" +
                        "                    <div class=\"weui-cells\">\n" +
                        "                        <div class=\"weui-cell left0\">\n" +
                        "                            <div class=\"weui-cell__hd\">\n" +
                        "                                <div class=\"touxiang\">\n" +
                        "                                    <img class=\"t-photo\" src=\""+data[i]['headimgurl']+"\" width=\"60\" height=\"60\">\n" +
                        "                                    {if "+data[i]['sex']+" == 2}\n" +
                        "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex2.png\" width=\"15\">\n" +
                        "                                    {else /}\n" +
                        "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex1.png\" width=\"15\">\n" +
                        "                                    {/if}\n" +
                        "                                </div>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"weui-cell__bd pos-tel\">\n" +
                        "                                <p class=\"f17\">"+data[i]['nickname']+"</p>\n" +
                        "                                <p class=\"xcz-chexing\">\n" +
                        "                                    <span>"+data[i]['car_info']+"</span>\n" +
                        "                                </p>\n" +
                        "                                {if "+data[i]['status']+"  ==2 }\n" +
                        "                                <div class=\"pos-xcjl\">已完成</div>\n" +
                        "                                {else /}\n" +
                        "                                <div class=\"pos-xcjl\">已取消</div>\n" +
                        "                                {/if}\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"weui-cell left0\">\n" +
                        "\n" +
                        "                            <div class=\"weui-cell__bd xingchengz\">\n" +
                        "\n" +
                        "                                <div class=\"weui-cells\">\n" +
                        "                                    <div class=\"weui-cell\">\n" +
                        "                                        <div class=\"weui-cell__hd\">\n" +
                        "                                            <img src=\"/sunfc/images/wait.png\" width=\"8\" class=\"wait\">\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"weui-cell__bd\">\n" +
                        "                                            <p>\n" +
                        "                                                <span>"+data[i]['create_time']+"</span>\n" +
                        "                                                <span class=\"font1\">"+data[i]['number']+"人</span>\n" +
                        "                                            </p>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <div class=\"weui-cell\">\n" +
                        "                                        <div class=\"weui-cell__hd\">\n" +
                        "                                            <span class=\"dian\"></span>\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"weui-cell__bd\">\n" +
                        "                                            <p>\n" +
                        "                                                <span>"+data[i]['begin_place']+"</span>\n" +
                        "                                                <span class=\"font1\">"+data[i]['begin_detail']+"</span>\n" +
                        "                                            </p>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <div class=\"weui-cell\">\n" +
                        "                                        <div class=\"weui-cell__hd\">\n" +
                        "                                            <span class=\"dian2\"></span>\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"weui-cell__bd\">\n" +
                        "                                            <p>\n" +
                        "                                                <span>"+data[i]['end_place']+"</span>\n" +
                        "                                                <span class=\"font1\">"+data[i]['end_detail']+"</span>\n" +
                        "                                            </p>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <p class=\"pos-yuan\"><span>"+data[i]['money']+"</span>元</p>\n" +
                        "                                </div>\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                    </div>\n" +
                        "                </div>");
                }
                if(data.length<4){
                    if(flag==0){
                        flag++;
                        var str = "<div id='zanwu' class=\"weui-cells__title\" style=\"line-height: 50px;text-align: center;margin-top: 0px\" >暂无更多数据</div>";
                        $("#list").find('.content-padded').append(str);
                    }
                    $("#list").find(".weui-loadmore").hide();
                }

            }
        );
        console.log('用户作为司机数据初始化');
        $.get('/index/sunfc.passenger/driver_log',
            function (res) {
                console.log('拿到司机初始化数据===》'+res.code);
                console.log(res.data);
                var data =res.data;
                console.log('拿到司机初始化数据长度===》'+data.length);
                for(var i=data.length-1;i>=0;i--){
                    console.log(i);
                    $("#list2").find('.content-padded').append("<div class=\"index-box index-xingchengz\">\n" +
                        "                    <div class=\"weui-cells\">\n" +
                        "                        <div class=\"weui-cell left0\">\n" +
                        "                            <div class=\"weui-cell__hd\">\n" +
                        "                                <div class=\"touxiang\">\n" +
                        "                                    <img class=\"t-photo\" src=\""+data[i]['headimgurl']+"\" width=\"60\" height=\"60\">\n" +
                        "                                    {if "+data[i]['sex']+" == 2}\n" +
                        "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex2.png\" width=\"15\">\n" +
                        "                                    {else /}\n" +
                        "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex1.png\" width=\"15\">\n" +
                        "                                    {/if}\n" +
                        "                                </div>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"weui-cell__bd pos-tel\">\n" +
                        "                                <p class=\"f17\">"+data[i]['nickname']+"</p>\n" +
                        "                                <p class=\"xcz-chexing\">\n" +
                        "                                    <span>"+data[i]['car_info']+"</span>\n" +
                        "                                </p>\n" +
                        "                                {if "+data[i]['status']+"  ==2 }\n" +
                        "                                <div class=\"pos-xcjl\">已完成</div>\n" +
                        "                                {else /}\n" +
                        "                                <div class=\"pos-xcjl\">已取消</div>\n" +
                        "                                {/if}\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"weui-cell left0\">\n" +
                        "\n" +
                        "                            <div class=\"weui-cell__bd xingchengz\">\n" +
                        "\n" +
                        "                                <div class=\"weui-cells\">\n" +
                        "                                    <div class=\"weui-cell\">\n" +
                        "                                        <div class=\"weui-cell__hd\">\n" +
                        "                                            <img src=\"/sunfc/images/wait.png\" width=\"8\" class=\"wait\">\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"weui-cell__bd\">\n" +
                        "                                            <p>\n" +
                        "                                                <span>"+data[i]['create_time']+"</span>\n" +
                        "                                                <span class=\"font1\">"+data[i]['number']+"人</span>\n" +
                        "                                            </p>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <div class=\"weui-cell\">\n" +
                        "                                        <div class=\"weui-cell__hd\">\n" +
                        "                                            <span class=\"dian\"></span>\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"weui-cell__bd\">\n" +
                        "                                            <p>\n" +
                        "                                                <span>"+data[i]['begin_place']+"</span>\n" +
                        "                                                <span class=\"font1\">"+data[i]['begin_detail']+"</span>\n" +
                        "                                            </p>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <div class=\"weui-cell\">\n" +
                        "                                        <div class=\"weui-cell__hd\">\n" +
                        "                                            <span class=\"dian2\"></span>\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"weui-cell__bd\">\n" +
                        "                                            <p>\n" +
                        "                                                <span>"+data[i]['end_place']+"</span>\n" +
                        "                                                <span class=\"font1\">"+data[i]['end_detail']+"</span>\n" +
                        "                                            </p>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                    <p class=\"pos-yuan\"><span>"+data[i]['money']+"</span>元</p>\n" +
                        "                                </div>\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                    </div>\n" +
                        "                </div>");
                }
                if(data.length<5){
                    if(flag1==0){
                        flag1++;
                        var str = "<div id='zanwu' class=\"weui-cells__title\" style=\"line-height: 50px;text-align: center;margin-top: 0px\" >暂无更多数据</div>";
                        $("#list2").find('.content-padded').append(str);
                    }
                    $("#list2").find(".weui-loadmore").hide();
                }
            }
        );
    });
    console.log('用户作为乘客数据滚动加载');
    $("#list").infinite().on("infinite", function() {
        console.log("'ss");
        var self = this;
        if(self.loading) return;
        console.log(self)
        self.loading = true;
        console.log(self);
        page++;
        setTimeout(function() {
            $.get('/index/sunfc.passenger/travel_records',{page:page},
                function (res) {
                    console.log("拿到"+page+"数据===》"+res.code);
                    console.log(res.data);
                    var data =res.data;
                    console.log(data.length);
                    for(var i=data.length-1;i>=0;i--){
                        console.log(i);
                        $("#list").find('.content-padded').append("<div class=\"index-box index-xingchengz\">\n" +
                            "                    <div class=\"weui-cells\">\n" +
                            "                        <div class=\"weui-cell left0\">\n" +
                            "                            <div class=\"weui-cell__hd\">\n" +
                            "                                <div class=\"touxiang\">\n" +
                            "                                    <img class=\"t-photo\" src=\""+data[i]['headimgurl']+"\" width=\"60\" height=\"60\">\n" +
                            "                                    {if "+data[i]['sex']+" == 2}\n" +
                            "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex2.png\" width=\"15\">\n" +
                            "                                    {else /}\n" +
                            "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex1.png\" width=\"15\">\n" +
                            "                                    {/if}\n" +
                            "                                </div>\n" +
                            "                            </div>\n" +
                            "                            <div class=\"weui-cell__bd pos-tel\">\n" +
                            "                                <p class=\"f17\">"+data[i]['nickname']+"</p>\n" +
                            "                                <p class=\"xcz-chexing\">\n" +
                            "                                    <span>"+data[i]['car_info']+"</span>\n" +
                            "                                </p>\n" +
                            "                                {if "+data[i]['status']+"  ==2 }\n" +
                            "                                <div class=\"pos-xcjl\">已完成</div>\n" +
                            "                                {else /}\n" +
                            "                                <div class=\"pos-xcjl\">已取消</div>\n" +
                            "                                {/if}\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"weui-cell left0\">\n" +
                            "\n" +
                            "                            <div class=\"weui-cell__bd xingchengz\">\n" +
                            "\n" +
                            "                                <div class=\"weui-cells\">\n" +
                            "                                    <div class=\"weui-cell\">\n" +
                            "                                        <div class=\"weui-cell__hd\">\n" +
                            "                                            <img src=\"/sunfc/images/wait.png\" width=\"8\" class=\"wait\">\n" +
                            "                                        </div>\n" +
                            "                                        <div class=\"weui-cell__bd\">\n" +
                            "                                            <p>\n" +
                            "                                                <span>"+data[i]['create_time']+"</span>\n" +
                            "                                                <span class=\"font1\">"+data[i]['number']+"人</span>\n" +
                            "                                            </p>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <div class=\"weui-cell\">\n" +
                            "                                        <div class=\"weui-cell__hd\">\n" +
                            "                                            <span class=\"dian\"></span>\n" +
                            "                                        </div>\n" +
                            "                                        <div class=\"weui-cell__bd\">\n" +
                            "                                            <p>\n" +
                            "                                                <span>"+data[i]['begin_place']+"</span>\n" +
                            "                                                <span class=\"font1\">"+data[i]['begin_detail']+"</span>\n" +
                            "                                            </p>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <div class=\"weui-cell\">\n" +
                            "                                        <div class=\"weui-cell__hd\">\n" +
                            "                                            <span class=\"dian2\"></span>\n" +
                            "                                        </div>\n" +
                            "                                        <div class=\"weui-cell__bd\">\n" +
                            "                                            <p>\n" +
                            "                                                <span>"+data[i]['end_place']+"</span>\n" +
                            "                                                <span class=\"font1\">"+data[i]['end_detail']+"</span>\n" +
                            "                                            </p>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <p class=\"pos-yuan\"><span>"+data[i]['money']+"</span>元</p>\n" +
                            "                                </div>\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                    </div>\n" +
                            "                </div>");
                    }
                    console.log(data.length);
                    if(data.length<4){
                        if(flag==0){
                            flag++;
                            var str = "<div id='zanwu' class=\"weui-cells__title\" style=\"line-height: 50px;text-align: center;margin-top: 0px\" >暂无更多数据</div>";
                            $(self).find(".content-padded").append(str);
                        }
                        $(self).find(".weui-loadmore").hide();
                    }
                    self.loading = false;
                }
            );

        }, 2000); //模拟延迟
    });
    console.log('用户作为司机数据滚动加载');
    $("#list2").infinite().on("infinite", function() {
        var self = this;
        if(self.loading) return;
        console.log(self)
        self.loading = true;
        console.log(self);
        page1++;
        setTimeout(function() {
            $.get('/index/sunfc.passenger/driver_log',{page:page1},
                function (res) {
                    console.log("拿到"+page+"数据===》"+res.code);
                    console.log(res.data);
                    var data =res.data;
                    console.log(data.length);
                    for(var i=data.length-1;i>=0;i--){
                        console.log(i);
                        $("#list2").find('.content-padded').append("<div class=\"index-box index-xingchengz\">\n" +
                            "                    <div class=\"weui-cells\">\n" +
                            "                        <div class=\"weui-cell left0\">\n" +
                            "                            <div class=\"weui-cell__hd\">\n" +
                            "                                <div class=\"touxiang\">\n" +
                            "                                    <img class=\"t-photo\" src=\""+data[i]['headimgurl']+"\" width=\"60\" height=\"60\">\n" +
                            "                                    {if "+data[i]['sex']+" == 2}\n" +
                            "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex2.png\" width=\"15\">\n" +
                            "                                    {else /}\n" +
                            "                                    <img class=\"t-icon\" src=\"/sunfc/images/sex1.png\" width=\"15\">\n" +
                            "                                    {/if}\n" +
                            "                                </div>\n" +
                            "                            </div>\n" +
                            "                            <div class=\"weui-cell__bd pos-tel\">\n" +
                            "                                <p class=\"f17\">"+data[i]['nickname']+"</p>\n" +
                            "                                <p class=\"xcz-chexing\">\n" +
                            "                                    <span>"+data[i]['car_info']+"</span>\n" +
                            "                                </p>\n" +
                            "                                {if "+data[i]['status']+"  ==2 }\n" +
                            "                                <div class=\"pos-xcjl\">已完成</div>\n" +
                            "                                {else /}\n" +
                            "                                <div class=\"pos-xcjl\">已取消</div>\n" +
                            "                                {/if}\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"weui-cell left0\">\n" +
                            "\n" +
                            "                            <div class=\"weui-cell__bd xingchengz\">\n" +
                            "\n" +
                            "                                <div class=\"weui-cells\">\n" +
                            "                                    <div class=\"weui-cell\">\n" +
                            "                                        <div class=\"weui-cell__hd\">\n" +
                            "                                            <img src=\"/sunfc/images/wait.png\" width=\"8\" class=\"wait\">\n" +
                            "                                        </div>\n" +
                            "                                        <div class=\"weui-cell__bd\">\n" +
                            "                                            <p>\n" +
                            "                                                <span>"+data[i]['create_time']+"</span>\n" +
                            "                                                <span class=\"font1\">"+data[i]['number']+"人</span>\n" +
                            "                                            </p>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <div class=\"weui-cell\">\n" +
                            "                                        <div class=\"weui-cell__hd\">\n" +
                            "                                            <span class=\"dian\"></span>\n" +
                            "                                        </div>\n" +
                            "                                        <div class=\"weui-cell__bd\">\n" +
                            "                                            <p>\n" +
                            "                                                <span>"+data[i]['begin_place']+"</span>\n" +
                            "                                                <span class=\"font1\">"+data[i]['begin_detail']+"</span>\n" +
                            "                                            </p>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <div class=\"weui-cell\">\n" +
                            "                                        <div class=\"weui-cell__hd\">\n" +
                            "                                            <span class=\"dian2\"></span>\n" +
                            "                                        </div>\n" +
                            "                                        <div class=\"weui-cell__bd\">\n" +
                            "                                            <p>\n" +
                            "                                                <span>"+data[i]['end_place']+"</span>\n" +
                            "                                                <span class=\"font1\">"+data[i]['end_detail']+"</span>\n" +
                            "                                            </p>\n" +
                            "                                        </div>\n" +
                            "                                    </div>\n" +
                            "                                    <p class=\"pos-yuan\"><span>"+data[i]['money']+"</span>元</p>\n" +
                            "                                </div>\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                    </div>\n" +
                            "                </div>");
                    }
                    console.log(data.length);
                    if(data.length<5){
                        if(flag1==0){
                            flag1++;
                            var str = "<div id='zanwu' class=\"weui-cells__title\" style=\"line-height: 50px;text-align: center;margin-top: 0px\" >暂无更多数据</div>";
                            $(self).find(".content-padded").append(str);
                        }
                        $(self).find(".weui-loadmore").hide();
                    }
                    self.loading = false;
                }
            );
        }, 2000); //模拟延迟
    });
</script>
</body>

</html>